<%@ include file="../../../base/include.jsp"%>
<div class="well actionbar">
	<div class="row-fluid">
		<button class="btn btn-primary"
				onclick="location.href='<c:url value='/admin/user/create'/>'">
				<i class="icon-plus icon-white"></i> Add user
		</button>
	
		<input id="query" value="${userListCommand.searchFilter}" onchange="resetQuery();" onkeypress="handleKeyPress(event);" 
				type="text" placeholder="Quick search" class="search-query">
	
		<a id="btnSearch" class="btn secondary"	href="#">
				<i class="icon-search"></i> Search
		</a>
	
		<tiles:insertAttribute name="navigation" />
	</div>
</div>
<script type="text/javascript">
	var query = "";
	resetQuery();
	function resetQuery() {
		query = document.getElementById("query").value;
		document.getElementById("btnSearch").setAttribute('href', '<c:url value="/admin/user/list/page/0/'+ query +'"/>');
	}
	function handleKeyPress(e) {
		var key=e.keyCode || e.which;
		if (key==13){
			resetQuery();
			document.getElementById("btnSearch").click();
		}
	}
</script>
